package com.woniu40.petai_manager.service;

import com.woniu40.petai_manager.entity.Brand;
import com.woniu40.petai_manager.mapper.BrandMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandService {

    @Autowired
    BrandMapper brandMapper;

    public List<Brand> findAllBrand(){
        return brandMapper.selectAll();
    }

    public int addBrand(Brand brand) {
        return brandMapper.insert(brand);
    }

    public int removeBrand(Integer brandId) {
        return brandMapper.deleteBrandById(brandId);
    }

    public Brand findById(Integer brandId) {
        return brandMapper.selectById(brandId);
    }

    public int modifyBrand(Brand brand) {
        return brandMapper.updateBrand(brand);
    }

    public int removeByIds(List<Integer> idList) {
        return brandMapper.deleteByIds(idList);
    }
}
